// components/TabBar/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    active : {
      type: Number,
      value: 0
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    list: [
      {
        pagePath: "/pages/home/index",
        text: "首页",
      },
      {
        pagePath: "/pages/CardRoll/index",
        text: "发现",
      },
      {
        pagePath: "/pages/discover/index",
        text: "卡卷",
      },
      {
        pagePath: "/pages/mine/index",
        text: "我的",
      }
    ]
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onChange(e) {
      console.log(e);
      var index = e.detail;
      console.log(this.data.list[index].pagePath)
      wx.switchTab({
        url: this.data.list[index].pagePath
      })
    }
  }
})
